<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>


<title>POS收单运营管理平台</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<link href="<s:url value="/css/common.css"/>" type="text/css"	rel="stylesheet" />

<script type="text/javascript"
	src="<s:url value="/js/jquery-1.9.1.js" />"></script>
<script type="text/javascript"
	src="<s:url value="/js/jquery.blockUI.js" />"></script>
<script type="text/javascript"
	src="<s:url value="/js/jquery.validate.min.js" />"></script>
<script type="text/javascript"
	src="<s:url value="/js/pwms.validate.js?v13" />"></script>
<script language="javascript" type="text/javascript"
	src="<s:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
<script type='text/javascript' src='<s:url value="/dwr/engine.js"/>'></script>
<script type='text/javascript' src='<s:url value="/dwr/interface/MccQuery.js"/>'></script>
<script type='text/javascript' src='<s:url value="/js/querySon.js"/>'></script>

<style type="text/css">

.error {
	color: red;
}
.groupCd_class{
}
</style>
<script type="text/javascript">

	$(document).ready(function() {
		//$("input").val("12");
		var mydate=new Date();
		var y=mydate.getFullYear();
		var m=mydate.getMonth()+1; 
		if(m<10){
		   m="0"+m
		}
		var d=mydate.getDate();
		if(d<10){
		   d="0"+d
		}
		$("#curDate").val(y+"-"+m+"-"+d);      
	    $("#inputOneOrgName").bind("blur",queryOneOrgName);  

		var isRsbFlag_ = $("#isRsbFlag").val(); 
		var isShowAreaFlag_ = $("#isShowAreaFlag").val(); 
		// 云商宝机构
	    if ( isRsbFlag_ == "1"  ) {
			$(".groupCd_class").change(function(){
				var groupCd = $("input[name='agent.groupCd']:checked").val(); 
				if ( groupCd != null && groupCd.trim() != "" && groupCd.trim() == "0" ) {
					$("input[name='agent.organizationCode']").rules('add',{
						required : true,
						stringMaxLength:33,
						isNumber:true,
						required : true,
						messages:{
							required: '必填',  
						}
					}); 
					$("select[name='agent.taxRegistrationCertificate']").rules('add',{
						 required : true,
						 messages:{
							 required: '必填',  
						}
					}); 
					$("#rsbTr").show();
					$("#h_ysbZl").show();
					$("#h_ysbZl_val").show();
				} else if ( groupCd != null && groupCd.trim() != "" && groupCd.trim() == "2" ) { // 间联直营 加税点
					$("select[name='agent.taxRegistrationCertificate']").rules('add',{
						 required : true,
						 messages:{
							 required: '必填',  
						}
					}); 

					$("#h_ysbZl").hide();
					$("#h_ysbZl_val").hide();
					$("#rsbTr").show();
					$("select[name='agent.taxRegistrationCertificate']").rules('remove'); 
				}else {
					$("input[name='agent.organizationCode']").rules('remove'); 
					$("select[name='agent.taxRegistrationCertificate']").rules('remove'); 
					$("#h_ysbZl").hide();
					$("#h_ysbZl_val").hide();
					$("#rsbTr").hide();
				}
			}); 
	    } else if ( isShowAreaFlag_ == "0" )  {
			$(".groupCd_class").change(function(){
				var groupCd = $("input[name='agent.groupCd']:checked").val(); 
				if ( groupCd != null && groupCd.trim() != "" && groupCd.trim() == "2" ) { // 间联直营 加税点

					$("select[name='agent.taxRegistrationCertificate']").rules('add',{
						 required : true,
						 messages:{
							 required: '必填',  
						}
					}); 
					$("#defTr").show();
				}else {
					$("select[name='agent.taxRegistrationCertificate']").rules('remove'); 
					$("select[name='agent.taxRegistrationCertificate']").val(''); 
					$("#defTr").hide();
				}
			}); 
	    }
	    //
	    
	    
		// 字符最大长度验证（一个中文字符长度为2）
		jQuery.validator.addMethod("stringMaxLength", function(value,element, param) {
			var length = value.length;
			for ( var i = 0; i < value.length; i++) {
				if (value.charCodeAt(i) > 127) {
					length++;
				}
			}
			return this.optional(element) || (length <=param);
		}, $.validator.format("长度不能大于{0}!"));

		// 字符最大长度验证（一个中文字符长度为2）
		jQuery.validator.addMethod("maxNumber", function(value,element, param) {
			// param[0] 整数最大长度,param[1] 小数点最大长度
			var reg = new RegExp('^(\\d{0,' + param[0] + '})$');
			
			// 如果文本值包含小数点
			if(value.indexOf(".") != -1){
				reg = new RegExp('^(\\d{0,' + param[0] + '})' + '\\.?\\d{1,' + param[1] +'}$');
			}
			return reg.test(value);
		}, $.validator.format("请填写整数最长{0}位，小数最长{1}位的值")); 

		// 纯数字校验
		jQuery.validator.addMethod("isNumberVal", function(value,element, param) {
			// 纯数字校验
			var reg = new RegExp('^[0-9]+$');
			return !reg.test(value);
		}, $.validator.format("请输入非纯数字的值")); 
		$("#agentForm").validate({
			debug : true,
			submitHandler : function(form) {
				
				var checkBox = $("input[name='agent.isUseDefModule']");
				if( null != checkBox && checkBox.length > 0 && checkBox[0].checked == true){
					form.submit();
				}else{
					var err = limitAmt();
					var errFee = limitFee();
					if (errFee != null && errFee != "") {
						alert(errFee);
					} else if (err != null && err != "") {
						alert(err);
					} else {
						form.submit();
					}
				}
			},
			rules : {
				"agent.orgCode" : {required : true},
				"agent.oneagentid" : {required : true},

				"agent.realName" : {required : true,stringMaxLength:150,remote:{
					type:'post',
					url:'<s:url value="/agent/vilidateAccountName.ct"/>',
					data:{
						"agent.realName":function()
						{
							return $('#validateAccountName').val();
						}
					}
				}
			},
				"agent.mobile" : {required : true,stringMaxLength:11,isNumber:true},
				"agent.accountNo" : {required : true,stringMaxLength:30,isABC:true,isNumberVal:true,remote:{
						type:'post',
						url:'validateAccountNo.ct',
						data:{
							"agent.accountNo":function()
							{
								return $('#validateAccountNo').val();
							}
						}
					}
				},
				"agent.cardType" : {required : true},
				"agent.cardNo" : {required : true,stringMaxLength:50,isIdCardNo:true},
				"agent.businessPerson":{required:true,stringMaxLength:30},
				"agent.businessPhone" : {required : true,stringMaxLength:11,isNumber:true},
				"agent.bankDeposit" : {required : true,stringMaxLength:150},
				"agent.bankAcctName" : {required : true,maxlength:50},
				"agent.bankAcctNo" : {required : true,stringMaxLength:50,isNumber:true},
				"agent.businessScope" : {required : true,stringMaxLength:200},
				"agent.address" : {required : true,stringMaxLength:200},
				
				"agent.email" : {email:true,stringMaxLength:50},
				"agent.companyid" : {required : true},
				"agent.taxRegistrationCertificate" : {required : true},
				"agent.organizationCode" : {required : true,stringMaxLength:33,isNumber:true},

				"agent.qq" : {required : false,stringMaxLength:11,isNumber:true},
				"agent.telphone" : {required : false,stringMaxLength:15},
				"agent.zipeCode" : {required : false,stringMaxLength:6,isNumber:true},
				"agent.remark" : {required : false,stringMaxLength:200},
		//		"agent.taxRegistrationCertificate" : {required : true},

				"agent.proList[0].profitFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"agent.proList[0].maxFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"agent.proList[0].profitSettleRate" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"agent.proList[0].merchantMinFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},

				"agent.proList[1].profitFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"agent.proList[1].maxFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"agent.proList[1].profitSettleRate" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"agent.proList[1].merchantMinFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				
				"agent.proList[2].profitFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"agent.proList[2].maxFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"agent.proList[2].profitSettleRate" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"agent.proList[2].merchantMinFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				
				"agent.proList[3].profitFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"agent.proList[3].maxFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"agent.proList[3].profitSettleRate" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"agent.proList[3].merchantMinFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				
				"agent.proList[4].profitFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"agent.proList[4].maxFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"agent.proList[4].profitSettleRate" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"agent.proList[4].merchantMinFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},


				"agent.profitPerList[0].limit_amt" : {required : true,stringMaxLength:15,maxNumber:[12,2]},
				"agent.profitPerList[0].max_amt" : {required : true,stringMaxLength:15,maxNumber:[12,2]},
				"agent.profitPerList[0].percent" : {required:true,stringMaxLength:12,isDecimal: function(){
														var min = 0;
														var max = 100;
														var accuracy = 0;
														return [min, max, accuracy];}},
				"agent.profitPerList[1].limit_amt" : {required : false,stringMaxLength:15,maxNumber:[12,2]},
				"agent.profitPerList[1].max_amt" : {required : false,stringMaxLength:15,maxNumber:[12,2]},
		        "agent.profitPerList[1].percent" : {required:false,stringMaxLength:12,isDecimal: function(){
														var min = 0;
														var max = 100;
														var accuracy = 0;
														return [min, max, accuracy];}},
				 "agent.profitPerList[2].limit_amt" : {required : false,stringMaxLength:15,maxNumber:[12,2]},
				 "agent.profitPerList[2].max_amt" : {required : false,stringMaxLength:15,maxNumber:[12,2]},
                 "agent.profitPerList[2].percent" : {required:false,stringMaxLength:12,isDecimal: function(){
														var min = 0;
														var max = 100;
														var accuracy = 0;
														return [min, max, accuracy];}},
				 "agent.profitPerList[3].limit_amt" : {required : false,stringMaxLength:15,maxNumber:[12,2]},
				 "agent.profitPerList[3].max_amt" : {required : false,stringMaxLength:15,maxNumber:[12,2]},
				 "agent.profitPerList[3].percent" : {required:false,stringMaxLength:12,isDecimal: function(){
														var min = 0;
														var max = 100;
														var accuracy = 0;
														return [min, max, accuracy];}}	,																																			

			},
			messages : {
				"agent.orgCode" : {required : "必填"},
				"agent.oneagentid" : {required : "必填"},
				 
				"agent.realName" : {required : "必填",remote:"名称格式不正确，只能输入中英文，数字，括号和空格"},
				"agent.mobile" : {required : "必填"},
				"agent.accountNo" : {required : "必填",isABC:"英文或数字",remote:"账号已存在"},
				"agent.cardType" : {required : "必填"},
				"agent.cardNo" : {required : "必填"},
				"agent.businessPerson":{required:"必填"},
				"agent.businessPhone" : {required : "必填"},
				"agent.bankDeposit" : {required : "必填"},
				"agent.bankAcctName" : {required : "必填"},
				"agent.bankAcctNo" : {required : "必填"},
				"agent.businessScope" : {required : "必填"},
				"agent.address" : {required : "必填"},
				"agent.email" : {email : "邮箱地址不正确"},
				"agent.companyid" : {required : "必填"},
				"agent.taxRegistrationCertificate" : {required : "必填"},
				"agent.organizationCode" : {required : "必填"},
				
		
				"agent.profitPerList[0].limit_amt" : {required : "必填",digits: "只能输入整数"},
				"agent.profitPerList[0].max_amt" : {required : "必填",digits: "只能输入整数"},
				
				"agent.profitPerList[0].percent" : {required : "必填",isDecimal : "分润比例只能是0-100的数字"},

				"agent.profitPerList[1].limit_amt" : {digits: "只能输入整数"},
				"agent.profitPerList[1].max_amt" : {digits: "只能输入整数"},
				"agent.profitPerList[1].percent" : {isDecimal : "分润比例只能是0-100的数字"},

				"agent.profitPerList[2].limit_amt" : {digits: "只能输入整数"},
				"agent.profitPerList[2].max_amt" : {digits: "只能输入整数"},
				"agent.profitPerList[2].percent" : {isDecimal : "分润比例只能是0-100的数字"},

				"agent.profitPerList[3].limit_amt" : {digits: "只能输入整数"},
				"agent.profitPerList[3].max_amt" : {digits: "只能输入整数"},
				"agent.profitPerList[3].percent" : {isDecimal : "分润比例只能是0-100的数字"}
										
				
			},errorPlacement: function(error, element) { 
			    if ( element.is(":radio") ) 
			        error.appendTo ( element.parent() ); 
			    else if ( element.is(":checkbox") ) 
			        error.appendTo ( element.parent() ); 

			    else if ( element.is("input") ) {
			    	var name = element[0].name;
			    	if(name == "agent.bankDeposit" || name == "agent.address" || name == "agent.qq" || name == "agent.telphone" 
			    			|| name == "agent.email" || name == "agent.zipeCode" || name == "agent.remark" ){
				        error.appendTo ( element.parent().parent() ); 
			    	}else if(name.indexOf("profitFee") != -1 || name.indexOf("maxFee") != -1 || name.indexOf("profitSettleRate") != -1 
			    			|| name.indexOf("merchantMinFee") != -1 || name.indexOf("limit_amt") != -1 || name.indexOf("max_amt") != -1 
			    			|| name.indexOf("percent") != -1){

				        error.appendTo ( element.parent() ); 
			    	}else{
				    	error.appendTo ( element.parent().next() );
			    	}
			    }
			    else 
			        error.insertAfter(element); 
			} 

		});
		
	});

	function limitFee(){
		var checkBox = $('#tabBody').find(":checkbox:checked");

		var profitFeeFmt = "input[name='agent.proList[t_index].profitFee']";
		var maxFeeFmt = "input[name='agent.proList[t_index].maxFee']";
		var profitSettleRateFmt = "input[name='agent.proList[t_index].profitSettleRate']";
		var merchantMinFeeFmt = "input[name='agent.proList[t_index].merchantMinFee']";
		
		if(null != checkBox && checkBox.length > 0){
			
			for (var s = 0; s < checkBox.length; s++){
				
	   			var tId = checkBox[s].name;
	   			var v_id = checkBox[s].value;
	   			var feeName = getFeeName( v_id );
	   			
	   			var index = tId.split("[")[1].split("]")[0];

				var profitFeeStr = profitFeeFmt.replace("t_index",index);
				var maxFeeStr = maxFeeFmt.replace("t_index",index);
				var profitSettleRateStr = profitSettleRateFmt.replace("t_index",index);
				var merchantMinFeeStr = merchantMinFeeFmt.replace("t_index",index);
				
				var profitFee = $(profitFeeStr).val();
				var maxFee = $(maxFeeStr).val();
				var profitSettleRate = $(profitSettleRateStr).val();
				var merchantMinFee = $(merchantMinFeeStr).val();
	   			
				var isReadonly = $(maxFeeStr).attr("readOnly");
				var seetleRate_isReadonly = $(profitSettleRateStr).attr("readOnly");
				var minFee_isReadonly = $(merchantMinFeeStr).attr("readOnly");

				if( $.trim( profitFee) == null || $.trim( profitFee) == "" || parseFloat( $.trim( profitFee ) ) <= 0  ) {
					return feeName + " 借记卡成本扣率 不能为空或为0.";
				}
				if(isReadonly == undefined){

					if( $.trim( maxFee) == null || $.trim( maxFee) == "" || parseFloat( $.trim( maxFee ) ) <= 0  ) {
						return feeName + " 借记卡封顶成本金额 不能为空或为0.";
					}
				}
				if(seetleRate_isReadonly == undefined){
					if( $.trim( profitSettleRate) == null || $.trim( profitSettleRate) == "" || parseFloat( $.trim( profitSettleRate)) <= 0  ) {
						return feeName + " 贷记卡成本扣率 不能为空或为0.";
					}
				}
				if(minFee_isReadonly == undefined){
					if( $.trim( merchantMinFee ) == null || $.trim( merchantMinFee ) == "" || parseFloat( $.trim( merchantMinFee ) ) <= 0  ) {
						return feeName + " 贷记卡最低签扣 不能为空或为0.";
					}
				}
				
				var cloudflashpay_fee = 0.28;
				
				// 如果是云闪付，默认 费率 为0.28
				if( null != v_id && "" != v_id && v_id == "05" ){

					if( $.trim( profitFee) == null || $.trim( profitFee) == "" || parseFloat( $.trim( profitFee ) ) != cloudflashpay_fee  ) {
						return feeName + " 借记卡成本扣率 只能等于 " + cloudflashpay_fee + ".";
					}
					if( $.trim( profitSettleRate) == null || $.trim( profitSettleRate) == "" || parseFloat( $.trim( profitSettleRate)) != cloudflashpay_fee  ) {
						return feeName + " 贷记卡成本扣率 只能等于  " + cloudflashpay_fee + ".";
					}
					if( $.trim( merchantMinFee ) == null || $.trim( merchantMinFee ) == "" || parseFloat( $.trim( merchantMinFee ) ) != cloudflashpay_fee  ) {
						return feeName + " 贷记卡最低签扣 只能等于  " + cloudflashpay_fee + ".";
					}
				}
				var unionpay_everyday_fee = 0.5025;
				
				// 如果是银联扫码（非优惠），默认 费率 不低于 0.5025
				if( null != v_id && "" != v_id && v_id == "06" ){
					if( $.trim( profitFee) == null || $.trim( profitFee) == "" || parseFloat( $.trim( profitFee ) ) < unionpay_everyday_fee  ) {
						return feeName + " 借记卡成本扣率 不能低于 " + unionpay_everyday_fee + ".";
					}
				}
				var unionpay_uneveryday_fee = 0.2;
				
				// 如果是银联扫码（优惠），默认 费率 不低于 0.2
				if( null != v_id && "" != v_id && v_id == "07" ){
					if( $.trim( profitFee) == null || $.trim( profitFee) == "" || parseFloat( $.trim( profitFee ) ) < unionpay_uneveryday_fee  ) {
						return feeName + " 借记卡成本扣率 不能低于 " + unionpay_uneveryday_fee + ".";
					}
				}
				var min_alipay_fee = 0.25;
				var max_alipay_fee = 0.35;
				// 如果是支付宝微信扫码，默认 费率 只能是 0.25-0.35之间
				if( null != v_id && "" != v_id && v_id == "08" ){
					if( $.trim( profitFee) == null || $.trim( profitFee) == "" || parseFloat( $.trim( profitFee ) ) < min_alipay_fee  
						 || parseFloat( $.trim( profitFee ) ) > max_alipay_fee  ) {
						return feeName + " 借记卡成本扣率 只能是 " + min_alipay_fee + "-" + max_alipay_fee + " 之间.";
					}
				}
				
			}
		}else{
			return "至少配置一条扣率信息!";
		}
	}

	function limitAmt(){
		var limitAmtFmt = "input[name='agent.profitPerList[t_index].limit_amt']";
		var maxAmtFmt = "input[name='agent.profitPerList[t_index].max_amt']";
		var percentFmt = "input[name='agent.profitPerList[t_index].percent']";
			 
		var arr = [];
		var l = 0;
		for(var i = 0; i<4; i++){
			var limitAmtStr = limitAmtFmt.replace("t_index",i);
			var maxAmtStr = maxAmtFmt.replace("t_index",i);
			var percentStr = percentFmt.replace("t_index",i);
			
			var limitAmt = $(limitAmtStr).val();
			var maxAmt = $(maxAmtStr).val();
			var percent = $(percentStr).val();
			
			if( ($.trim(limitAmt) != null && $.trim(limitAmt) != "") 
					|| ($.trim(maxAmt) != null && $.trim(maxAmt) != "") 
					|| ($.trim(percent) != null && $.trim(percent) != "") ){

				if( ($.trim(limitAmt) == null || $.trim(limitAmt) == "") ){
					return "第" + (i + 1) + "行区间最小金额不能为空.";
				}/* else if( ($.trim(maxAmt) == null || $.trim(maxAmt) == "") ){
					return "第" + (i + 1) + "行区间最大金额不能为空.";
				} */else if( ($.trim(percent) == null || $.trim(percent) == "") ){
					return "第" + (i + 1) + "行分润比例不能为空.";
				}else if( parseFloat($.trim(percent)) <= 0 ){
					return "第" + (i + 1) + "行分润比例必须大于0.";
				}else{
					var row = [$.trim(limitAmt),$.trim(maxAmt),$.trim(percent),(i+1)];
					arr[l] = row;
					l++;
				}
			}
		}
		if(arr.length > 1){
			for(var s = 1; s < arr.length ; s++){
				var row1 = arr[s-1];
				var row2 = arr[s];
				// 如果不是最后一行,且 区间最大金额为空     注:最后一行的 区间最大金额 可以为空
				if(s < (arr.length-1) && ( $.trim(row2[1]) == null || $.trim(row2[1]) == "" )  ){
					return "第" + (row2[3]) + "行区间最大金额不能为空.";
				}
				
				if( parseFloat($.trim(row1[0])) >= parseFloat($.trim(row2[0])) ){
					return "第" + (row2[3]) + "行的区间最小金额 必须大于 第" + row1[3] + "行的区间最小金额." ;
				}
				if( $.trim(row2[1]) != null && $.trim(row2[1]) != "" ){
					if( parseFloat($.trim(row1[1])) >= parseFloat($.trim(row2[1])) ){
						return "第" + (row2[3]) + "行的区间最大金额 必须大于 第" + row1[3] + "行的区间最大金额." ;
					}
				}
				if( parseFloat($.trim(row1[2])) >= parseFloat($.trim(row2[2])) ){
					return "第" + (row2[3]) + "行的分润比例 必须大于 第" + row1[3] + "行的分润比例." ;
				}
				if(parseFloat($.trim(row1[1])) != parseFloat($.trim(row2[0]))){
					return "第" + (row2[3]) + "行的区间最小金额 必须等于 第" + row1[3] + "行的区间最大金额.";
				}
			}
		}
	}
	
 
	//加载区域属性信息
	function loadAreaByOneOrgCode ( oneOrgCode ) {

		MccQuery.loadAreaByOneOrgCode(oneOrgCode, function(sortSmall) {
			$("#companyid").val(sortSmall);
		});
	}

	function queryOneOrgName(){
		var oneOrgName = $("#inputOneOrgName").val(); 

		if ( oneOrgName != null && oneOrgName.trim() != "" ) {
			// 机构号/所属区域设为初始状态
			$("#oneagentid").val("");
			$("#companyid").val(""); 
			
			$("#oneagentid option").each(function(){
				if($(this).text() == oneOrgName){  
					var oneOrgCode = $(this).val();
					$("#oneagentid").val(oneOrgCode);
					// 根据一级机构号，选中某个区域
					loadAreaByOneOrgCode(oneOrgCode);
				}  
			});
		}
	}
</script>



</head>

<body>
			<s:form id="agentForm" action="/agent/addAgent.ct" method="post"  theme="simple"  >
				<table width="100%" class="tb" >
			        <tr class="tb-line">
			            <td class="tb-td" colspan="6">
				            <div class="tb-h2">POS收单运营管理平台</div>
					   	</td>
			        </tr>
	                <tr class="tb-line bg-gray">
			            <td class="tb-td" colspan="4"><div class="tb-h3">申请代理商</div></td>
			        </tr>
			
					<tr class="tb-line">
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">申请人：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-input-lengthen">
			             		<s:textfield value="%{#request.op.accountNo}" disabled="true"/> 
			             	</label>
			             	<font color="red">*</font> 
			            </td>
						
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">日期：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-input-lengthen"> 
			             		<s:textfield id="curDate" disabled="true"/> 
			             	</label>
			             	<font color="red">*</font>
			             </td>
					</tr>
	                <tr class="tb-line bg-gray">
			            <td class="tb-td" colspan="4"><div class="tb-h3">代理商基本信息</div></td>
			        </tr>
					<tr class="tb-line">
					
						<s:if test="#session.session_merchant.roleType==\"00\"||#session.session_merchant.roleType==\"01\" || #request.superRole == \"00\"">
						
					    	<td align="right" class="tb-td" style="width:110px;">
					        	<div class="tb-h4">角色类别：</div>
				            </td>
				            <td class="tb-td" >
				             	<label class="tb-select">
									<s:select cssClass="queryWidth" name="agent.roleType" id="roleType"
										list="#{'02':'机构管理员' }" listKey="key" listValue="value"/>
								</label>
								<font color="red">*</font>
							</td>
						</s:if>
						<s:else>
					    	<td align="right" class="tb-td" style="width:110px;">
					        	<div class="tb-h4">角色类别：</div>
				            </td>
				            <td class="tb-td" >
				             	<label class="tb-select">
									<s:select cssClass="queryWidth" name="agent.roleType" id="roleType"
										list="#{'03':'代理商' }" listKey="key" listValue="value"/>
								</label>
								<font color="red">*</font>
							</td>
						</s:else>
					     
					 <s:if test="#session.session_merchant.roleType==\"02\"||#session.session_merchant.roleType==\"03\"||#session.session_merchant.roleType==\"15\" || #session.session_merchant.roleType==\"16\" || #request.superRole == \"02\"">
						
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4"></div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-input-lengthen">
						  		<s:hidden name="agent.orgCode" value="%{#session.session_merchant.orgCode}" />
						  	</label>
						</td>
					</s:if>
					<s:else>
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">所属机构：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-select">
								<s:select cssClass="queryWidth" name="agent.orgCode" id="orgCode"
								list="#request.orgList" listKey="insIdCd" listValue="insName" />
							</label>	
			             	<label class="tb-select">
								<s:select cssClass="queryWidth" name="agent.oneagentid" id="oneagentid"
								list="#request.orgMainList" listKey="orgCode" listValue="orgName" headerKey="" headerValue="--请选择--" onchange="loadAreaByOneOrgCode ( this.value )"  />
							</label>	
                 			<label class="tb-input-normal"><s:textfield   id="inputOneOrgName"  placeholder="请输入机构名称"   /> </label>
							<font color="red">*</font>
						</td>
					</s:else>
					</tr>
					<tr class="tb-line">
						<%-- <td align="right" width="15%">代理商类别：</td>
						<td>
							<s:select cssClass="queryWidth" name="agent.agentType" id="orgCode"
								list="#request.agTypeList" listKey="key" listValue="value"/><font color="red">*</font>
						 </td>
					     --%>
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">经营地区：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-select">
								<s:select name="agent.areaCode" list="#request.areaList"  listKey="key" listValue="value"   cssClass="queryWidth" />
						 	</label>
						 	<font color="red">*</font>
						</td>
					     
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">经营范围：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-input-lengthen">
			             		<s:textfield maxLength="200" name="agent.businessScope"
									cssClass="queryWidth"></s:textfield>
								</label>
								<font color="red">*</font>
						</td>
						</tr>
						
						<tr class="tb-line">
				    		<td align="right" class="tb-td" style="width:110px;">
				        		<div class="tb-h4">甲方名称：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-input-lengthen">
			             		<s:textfield maxlength="150" name="agent.realName" cssClass="queryWidth" id="validateAccountName"/>
			             	</label>
			             	<font color="red">*</font> 
			             </td>
					
				    	<td align="right" class="tb-td" style="width:110px;">
				        		<div class="tb-h4">性别：</div>
			            </td>
			            <td class="tb-td" >
			             		<s:radio name="agent.sex" list="#{'1':'男','0':'女' }" value="1"></s:radio>
						 </td>
						
						</tr>
						
					   <tr class="tb-line">
				    		<td align="right" class="tb-td" style="width:110px;">
				        		<div class="tb-h4">登录账号：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-input-lengthen">
			             		<s:textfield maxlength="30" name="agent.accountNo" cssClass="queryWidth" id="validateAccountNo"/>
			             	</label>
			             	<font color="red">*</font>
			             </td>
						<td align="right" class="tb-td" style="width:110px;">
				        		<div class="tb-h4">手机号：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-input-lengthen">
			             		<s:textfield maxlength="11" name="agent.mobile" cssClass="queryWidth" /> 
			             	</label>
			             	<font color="red">*</font>
			             </td>
					</tr>
					<tr class="tb-line">
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">证件类型：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-select">
								<s:select cssClass="queryWidth" name="agent.cardType" id="cardType"
								list="#{'01':'身份证','02':'护照','03':'军官证','04':'驾照','05':'其他' }" />
							</label>
							<font color="red">*</font>
						 </td>
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">证件号码：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-input-lengthen">
			             		<s:textfield maxlength="50" name="agent.cardNo" cssClass="queryWidth" /> 
			             	</label>
			             	<font color="red">*</font>
			             </td>
					</tr>
					<tr class="tb-line">
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">业务联系人：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-input-lengthen">
			             		<s:textfield maxlength="30" name="agent.businessPerson" cssClass="queryWidth"/>
			             	</label>
			             	<font color="red">*</font>
			             </td>
						
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">业务联系人电话：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-input-lengthen">
			             		<s:textfield maxlength="11" name="agent.businessPhone" cssClass="queryWidth" />
			             	</label>
			             	<font color="red">*</font> 
			            </td>
					</tr>
					<tr class="tb-line">
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">开户行：</div>
			            </td>
			            <td class="tb-td" >
			             	<label >
			             		<s:textfield id ="aaa" maxlength="150" name="agent.bankDeposit" cssClass="queryWidth" readonly="false" 
			             			style="color: #000;font-size: 12px;height: 22px;line-height: 22px;width:300px;"/>
			             	</label>
							<s:hidden id = "bbb" name = "agent.bank_no"/>
							<font color="red">*</font>
							<!-- <input  type="button"  onclick="showPosInfoWindow()" value="选择" /> -->
						</td>
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">账户名称：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-input-lengthen">
			             		<s:textfield maxlength="50" name="agent.bankAcctName" cssClass="queryWidth" />
			             	</label>
			             	<font color="red">*</font>
			            </td>
					</tr>
					<tr class="tb-line">
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">银行账户：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-input-lengthen">
			             		<s:textfield maxlength="50" name="agent.bankAcctNo" cssClass="queryWidth"/> 
			             	</label>
			             	<font color="red">*</font>
			             </td>
						
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">业务联系QQ：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-input-lengthen">
			             		<s:textfield maxlength="11" name="agent.qq" cssClass="queryWidth" /> 
			             	</label>
			             </td>
					</tr>
					<tr class="tb-line">
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">电话号码：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-input-lengthen">
			             		<s:textfield maxlength="15" name="agent.telphone" cssClass="queryWidth"/> 
			             	</label>
			             </td>
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">邮箱地址：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-input-lengthen">
			             		<s:textfield maxlength="50" name="agent.email" cssClass="queryWidth" /> 
			             	</label>
			             </td>
					</tr>
					<tr class="tb-line">
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">邮政编码：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-input-lengthen">
			             		<s:textfield maxlength="6" name="agent.zipeCode" cssClass="queryWidth" /> 
			             	</label>
			             </td>
						
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">商户类别:</div>
			            </td>
			            <td class="tb-td" >
			             	<s:radio name="agent.groupCd" id="groupCd" class="groupCd_class" list="#{'1':'直联','0':'间联','2':'间联直营'  }" value="0"></s:radio>
			            </td>
					</tr>
					<s:hidden name="isRsbFlag" id="isRsbFlag" value="%{#request.isRsbFlag}" />
					<s:hidden name="isShowAreaFlag" id="isShowAreaFlag" value="%{#request.isShowAreaFlag}" />
					
					<s:if test=" #request.isShowAreaFlag==\"1\"  ">
					
					<tr class="tb-line">
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">所属区域：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-select">
								<s:select cssClass="queryWidth" name="agent.companyid" id="companyid" disabled="true" 
								list="#request.companyList" listKey="id" listValue="name" headerKey="" headerValue="--请选择--"/>
							</label>	
							<font color="red">*</font>
						</td>
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">发票扣率：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-select">
								<s:select name="agent.taxRegistrationCertificate" list="#request.invoiceRateMap" listKey="key" 
								listValue="value"   headerKey="" headerValue="--请选择--" cssClass="queryWidth" />
						 	</label>
						 	<font color="red">*</font>
						</td>
						
					</tr>
					<tr class="tb-line">
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">序号编码：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-select">
			             		<s:textfield maxlength="33" name="agent.organizationCode" cssClass="queryWidth" />
						 	</label>
						 	<font color="red">*</font>
						</td>
						
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">是否直营：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-select">
			             		<s:radio name="agent.directFlag" list="#{'1':'否','2':'是' }" value="1"></s:radio>
						 	</label>
						 	<font color="red">*</font>
						</td>
					</tr>
					</s:if>
					
					<s:elseif test=" #request.isRsbFlag==\"1\"  ">
					
					<tr class="tb-line" id = "rsbTr">
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">发票扣率：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-select">
								<s:select name="agent.taxRegistrationCertificate" list="#request.invoiceRateMap" listKey="key" 
								listValue="value"   headerKey="" headerValue="--请选择--" cssClass="queryWidth" />
						 	</label>
						 	<font color="red">*</font>
						</td>
						
				    	<td align="right" class="tb-td" id="h_ysbZl" style="width:110px;">
				        	<div class="tb-h4">序号编码：</div>
			            </td>
			            <td class="tb-td" id="h_ysbZl_val" >
			             	<label class="tb-select">
			             		<s:textfield maxlength="33" name="agent.organizationCode" cssClass="queryWidth" />
						 	</label>
						 	<font color="red">*</font>
						</td>
					</tr>
					</s:elseif>
					<s:else>
						<tr class="tb-line" id = "defTr" style="display: none;">
					    	<td align="right" class="tb-td" style="width:110px;">
					        	<div class="tb-h4">发票扣率：</div>
				            </td>
				            <td class="tb-td" >
				             	<label class="tb-select">
									<s:select name="agent.taxRegistrationCertificate" list="#request.invoiceRateMap" listKey="key" 
									listValue="value"   headerKey="" headerValue="--请选择--" cssClass="queryWidth" />
							 	</label>
							 	<font color="red">*</font>
							</td>
						</tr>
					</s:else>
					
					<%-- 
					<tr class="tb-line">
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">发票扣率：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-select">
								<s:select name="agent.taxRegistrationCertificate" list="#request.invoiceRateMap" listKey="key" 
								 headerKey="" headerValue="--请选择--" listValue="value"   cssClass="queryWidth" />
						 	</label>
						 	<font color="red">*</font>
						</td>
					</tr> --%>
					<%-- <tr class="tb-line">
						<td align="right" width="15%">经营范围：</td>
						<td colspan="3"><s:textfield maxLength="65" name="agent.businessScope"
								cssStyle="width:95%;"></s:textfield><font
							color="red">*</font></td>
					</tr> --%>
					<tr class="tb-line">
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">详细地址：</div>
			            </td>
			            <td class="tb-td" colspan="3" style="height:auto;line-height:auto;" >
			             	<label style="height:auto;line-height:auto;">
			             		<s:textfield maxLength="200" name="agent.address"
								  style="height: 30px; resize: none; width: 890px;padding:0 5px;" ></s:textfield>
								
			             	</label>
			             	<font color="red">*</font>
			            </td>
					</tr>
					<tr class="tb-line">
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">备注：</div>
			            </td>
			            <td class="tb-td" colspan="3" style="height:auto;line-height:auto;" >
			             	<label style="height:auto;line-height:auto;">
			             		<s:textarea rows="5" cssClass="someWidth" 
								name="agent.remark" maxlength="200"  style="height: 102px; resize: none; width: 530px;padding:0 5px;" />
			             	</label>
			             </td>
					</tr>
				</table>
				<s:if test=" #request.moduleSize>0 ">
					<div>
						<s:checkboxlist name="agent.isUseDefModule" list="#{'1':'是否使用默认分润模板'}" theme="simple" 
							onclick="isUseDefModule(this)"></s:checkboxlist>
					</div>
				</s:if>
				<div class="tab-body" id="tabBody" >
				
					<div class="tab-title bg-gray">
						<div class="tb-title active">扣率配置</div>
					    <div class="tb-title">分润比例</div>
					</div>
				
				   <div class="tab-cnt">
					   <table class="tb" style="display: block;">
						  <tbody>
							<tr>
								<td colspan="6">
									<table  width="100%">
										<tr class="tb-line"> 
											<td class="tb-td">
						                        <div class="tb-h4">成本扣率</div>
						                    </td>
											<td class="tb-td">
						                        <div class="tb-h4">借记卡成本扣率</div>
						                    </td>
											<td class="tb-td">
						                        <div class="tb-h4">借记卡封顶成本金额</div>
						                    </td>
											<td class="tb-td">
						                        <div class="tb-h4">贷记卡成本扣率</div>
						                    </td>
											<td class="tb-td">
						                        <div class="tb-h4">贷记卡最低签扣</div>
						                    </td>
										</tr>
										<s:iterator value="#request.mccList" var="a" status="stat">
											<tr class="tb-line">
												 <td class="tb-td" >
														<s:checkboxlist name="agent.proList[%{#stat.index}].id" list="#{#a.key:''}" theme="simple"></s:checkboxlist>
														<s:property value="#a.value"/>
													<!--hidden-->
													<s:hidden name="agent.proList[%{#stat.index}].mccTypeCode" value="%{#a.key}"/>
													<s:hidden name="agent.proList[%{#stat.index}].mccTypeName" value="%{#a.value}"/>
													 
												</td>
												<td class="tb-td" >
									                <label class="tb-input-normal">
									                 	<s:textfield   name="agent.proList[%{#stat.index}].profitFee" maxlength="12" /> 
									                </label> 
													  % 
												 </td> 
												<td class="tb-td" >
									                <label class="tb-input-normal"> 
														 <s:if test=" #a.key==\"04\" || #a.key==\"05\" || #a.key==\"06\" || #a.key==\"07\" || #a.key==\"08\"">
														 	<s:textfield  name="agent.proList[%{#stat.index}].maxFee" maxlength="12"  cssStyle="background-color:lightgray;" readonly="true" />
														 </s:if>
														 <s:else>
														 	<s:textfield  name="agent.proList[%{#stat.index}].maxFee" maxlength="12" />
														 </s:else>
													</label>
													 元
												</td>
												<td class="tb-td" > 
									                <label class="tb-input-normal">
														<s:if test=" #a.key==\"06\" || #a.key==\"07\" || #a.key==\"08\"">
									                		<s:textfield  name="agent.proList[%{#stat.index}].profitSettleRate" maxlength="12"  cssStyle="background-color:lightgray;" readonly="true" />
									                	</s:if>
														<s:else>
															<s:textfield  name="agent.proList[%{#stat.index}].profitSettleRate" maxlength="12" />
														</s:else>
									                </label> 
									                %
												</td>
												<td class="tb-td" >
									                <label class="tb-input-normal">
														<s:if test=" #a.key==\"06\" || #a.key==\"07\" || #a.key==\"08\"">
									                		<s:textfield  name="agent.proList[%{#stat.index}].merchantMinFee" maxlength="12"  cssStyle="background-color:lightgray;" readonly="true" />
									                	</s:if>
														<s:else>
															<s:textfield  name="agent.proList[%{#stat.index}].merchantMinFee" maxlength="12" />
														</s:else>
									                </label>
									                %</td>
											</tr>
										</s:iterator>
									</table>
								</td>
							</tr>
						</tbody>
					</table>
			
		  			<table class="tb" style="display: none;">
						<tbody>
						   	<tr class="tb-line">
								 <td class="tb-td" colspan="3" align="center">
								 填写说明:区间内的金额范围请按照从小到大填写,最后一个区间段的最大金额可不填
								 </td>
							</tr>
							<tr class="tb-line">
								<td></td>
							</tr>
							<tr class="tb-line">
								<td colspan="3">
									<table  width="100%">
										<tr class="tb-line">
											<td  class="tb-td" >
						                        <div class="tb-h4">区间最小金额</div>
						                    </td>
											<td  class="tb-td" >
						                        <div class="tb-h4">区间最大金额(含)</div>
						                    </td>
											<td  class="tb-td" >
						                        <div class="tb-h4">分润比例(0-100)</div>
						                    </td>
										</tr>
										<s:iterator value="#request.perList" var="b" status="stat2">
											<tr class="tb-line">
												<td class="tb-td" >
										        	<label class="tb-input-normal">
										            	<s:textfield  name="agent.profitPerList[%{#stat2.index}].limit_amt" maxlength="15" />
													</label>
													<s:if test=" #stat2.index==\"0\" ">
														<font color="red">*</font>
													</s:if>元
												</td>
												<td class="tb-td" >
										            <label class="tb-input-normal">
										            	<s:textfield  name="agent.profitPerList[%{#stat2.index}].max_amt" maxlength="15" />
													</label>
													<s:if test=" #stat2.index==\"0\" ">
													 	<font color="red">*</font>
													</s:if>元
												</td>
												<td class="tb-td" >
										            <label class="tb-input-normal">
										            	<s:textfield  name="agent.profitPerList[%{#stat2.index}].percent" maxlength="12" />
													</label>
													<s:if test=" #stat2.index==\"0\" ">
														<font color="red">*</font>
													</s:if>%
												</td>
												<td></td>
											</tr>
										</s:iterator>
									</table>
								</td>
							</tr>
						</tbody>
					</table>   
		</div>
		    
		</div>
		<div id="defProfitModuleDiv" style="display: none;">
			<table class="tb" style="width:100%">
			    <tbody>
	                <tr class="tb-line bg-gray">
			            <td  align="center" class="tb-td"  colspan="4"><div class="tb-h3">代理商拓展范围</div></td>
			        </tr>
					<tr class="tb-line">
						<td class="tb-td" colspan="4" style="padding:0;">
 							<table style="width: 100%" id="defRuleTable">
							</table>
						</td>
					</tr>
	                <tr class="tb-line bg-gray">
			            <td  align="center" class="tb-td"  colspan="4"><div class="tb-h3">代理商分润比例</div></td>
			        </tr>
					<tr class="tb-line">
						<td colspan="4">
							<table  width="100%" id="defProTable">
							 
							</table>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
		
		      <table width="100%" border="0" cellspacing="0" class="table">
		           	<tr class="tb-line">
						<td colspan="4" align="center"><span style="color: red"><s:actionerror /></span>
							<span style="color: red;"><s:actionmessage /></span > <span style="color: red;"><s:fielderror
									cssClass="fieldError" /></span>
							<span id="otherError"></span>
						</td>
					</tr>
					<tr class="tb-line">
			            <td class="tb-td line-submit" align="center" colspan="4">
			                <label class="tb-input-submit">
								<s:submit onclick="checkAccountNo();" id="btnAdd" value="保  存" /> 
							</label>
			                <label class="tb-input-submit">
								<input type="reset" value="取  消"/>
							</label>
						</td>
					</tr>
            </table>
			</s:form>
	<s:if test="#request.msg !=null">
		<script language="javascript">
		    alert("${request.msg}");
			window.location="${rootPath}/agent/agentJsp.ct";
		</script>
	</s:if>
</body>

<script type="text/javascript">
 $(function () {
        $('#tabBody').on('click', '.tab-title .tb-title', function () {
            var $this = $(this); /// 点击的对象
            var index = $this.index();  // 点击对象的下标

            // 点击的对象添加active，同类对象移除active
            $this.addClass('active').siblings().removeClass('active');

            // 查找与点击对象相同关系的列表显示并隐藏同类对象
            $('#tabBody').find('.tab-cnt .tb').eq(index).show().siblings().hide();
        });
        var groupCdR = $("input[name='agent.groupCd']:checked").val(); 
        if ( groupCdR != null && groupCdR.trim() != "" && groupCdR.trim() == "0" ) { // 初始化间联去税点
			$("select[name='agent.taxRegistrationCertificate']").rules('remove'); 
		} 
    });
    
  function showPosInfoWindow(){
    	    
         var ScreenWidth = screen.availWidth ;
         var ScreenHeight = screen.availHeight; 
         var StartX = (ScreenWidth - innerWidth) / 2 ;
         var StartY = (ScreenHeight - innerHeight) / 2 ;
    	 var url =  "<%=basePath %>chooseBank/init.ct";
    	 window.open(url, '选择开户行', 'left='+ StartX + ', top='+ StartY + ', Width=' + innerWidth +', height=' + innerHeight + ', resizable=no, scrollbars=yes, status=no, toolbar=no, menubar=no, location=no'); 
    }    
  function checkAccountNo(){
		var accountNo = $("#validateAccountNo").val(); 
    	$.ajax({
    		url:"validateAccountNo.ct",
	  		data:{"agent.accountNo":accountNo},
	  		dataType:"json",
	  		type:"POST",
	  		success:function(result){
	  			if(result == false){
		  			alert("账号已存在");
	  			}
	  		},error:function(rsg){
	  			  
	  		}
    	});
	  
  }


	function isUseDefModule(objCheckbox){
	 	if(objCheckbox.checked){
	 	 	$('#tabBody').find(":text").each(function(){
	   		 	$(this).attr('disabled',true);
	 	 	});
	 	 	loadDefProfitModule();
	 	}else{
	 	 	$('#tabBody').find(":text").each(function(){
	   		 	$(this).attr('disabled',false);
	 	 	});
			$('#defProfitModuleDiv').hide();
			$('#tabBody').show();
	 	}
	} 
	
</script>

</html>
